﻿#include "TcpCodec_HeartBeat.h"

#include "TcpCodec.h"
#include "HeartBeatManager.h"

TcpCodec_HeartBeat::TcpCodec_HeartBeat()
{
  setObjectName(getClassNameFirstLow<TcpCodec_HeartBeat>());
}

TcpCodec_HeartBeat::~TcpCodec_HeartBeat()
{

}

void TcpCodec_HeartBeat::decode(DataPackage_TcpCodec* dataPackageInfo_User)
{
  (void)dataPackageInfo_User;
  heartBeatManager->updateHeartBeat();
}

TcpCodec* TcpCodec_HeartBeat::getTcpCodec()const
{
  return tcpCodec;
}

TcpCodec_HeartBeat* TcpCodec_HeartBeat::setTcpCodec(TcpCodec* const tcpCodec)
{
  this->tcpCodec=tcpCodec;
  tcpCodec->addToCodecMap(TcpCodec_HeartBeat::HeartBeat,this);
  printInjection(this,tcpCodec);
  return this;
}

HeartBeatManager* TcpCodec_HeartBeat::getHeartBeatManager()const
{
  return heartBeatManager;
}

TcpCodec_HeartBeat* TcpCodec_HeartBeat::setHeartBeatManager(HeartBeatManager*const heartBeatManager)
{
  this->heartBeatManager=heartBeatManager;
  printInjection(this,heartBeatManager);
  return this;
}

void TcpCodec_HeartBeat::objectAutoInjection(QHash<QString,QObject*>* objMap)
{
  setTcpCodec(getObjFromMap<TcpCodec>(objMap));
  setHeartBeatManager(getObjFromMap<HeartBeatManager>(objMap));
}
